<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">
<script>
    (function () {
        if ('') {
            if (prompt('请输入文章密码') !== '') {
                alert('密码错误！');
                if (history.length === 1) {
                    location.replace("https://google.com"); // 这里替换成你的首页
                } else {
                    history.back();
                }
            }
        }
    })();
</script>








<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="php,项目,">










<meta name="description" content="excel123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101">
<meta name="keywords" content="php,项目">
<meta property="og:type" content="article">
<meta property="og:title" content="有用的PHP项目收集">
<meta property="og:url" content="http://yoursite.com/2018/12/12/有用的PHP项目收集/index.html">
<meta property="og:site_name" content="苏生不惑的博客">
<meta property="og:description" content="excel123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-10-11T09:26:57.119Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="有用的PHP项目收集">
<meta name="twitter:description" content="excel123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2018/12/12/有用的PHP项目收集/">



<meta name="referrer" content="never"> ​​​​


  <title>有用的PHP项目收集 | 苏生不惑的博客</title>
  








</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">苏生不惑的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2018/12/12/有用的PHP项目收集/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="苏生不惑">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏生不惑的博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">有用的PHP项目收集</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-12-12T14:06:33+08:00">
                2018-12-12
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"></i>
            <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>次
            </span>
          

          
            <div class="post-wordcount">
              
                
                  <span class="post-meta-divider">|</span>
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  5.5k 字
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  29 分钟
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="excel"><a href="#excel" class="headerlink" title="excel"></a>excel</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br></pre></td><td class="code"><pre><span class="line">composer <span class="built_in">require</span> maatwebsite/excel</span><br><span class="line"></span><br><span class="line">composer <span class="built_in">require</span> box/spout</span><br><span class="line">php artisan make:command ExcelReader</span><br><span class="line">&lt;?php</span><br><span class="line"></span><br><span class="line">namespace App\Console\Commands;</span><br><span class="line"></span><br><span class="line">use App\Imports\TestImport;</span><br><span class="line">use Box\Spout\Common\Type;</span><br><span class="line">use Box\Spout\Reader\ReaderFactory;</span><br><span class="line">use Illuminate\Console\Command;</span><br><span class="line">use Maatwebsite\Excel\Facades\Excel;</span><br><span class="line">use PhpOffice\PhpSpreadsheet\Settings;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">ExcelReader</span> <span class="keyword">extends</span> <span class="title">Command</span></span></span><br><span class="line"><span class="class"></span>&#123;</span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * The name and signature of the console command.</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * @var string</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    protected $signature = <span class="string">'excel:reader &#123;path&#125; &#123;--drive=laravel-excel&#125;'</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * The console command description.</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * @var string</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    protected $description = <span class="string">'Command description'</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 测试文件的行数</span></span><br><span class="line"><span class="comment">     * @var int</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    private $rows = <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 程序运行消耗的时间(s)</span></span><br><span class="line"><span class="comment">     * @var int</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    private $timeUsage = <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 程序运行消耗的内存(byte)</span></span><br><span class="line"><span class="comment">     * @var int</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    private $memoryUsage = <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * Create a new command instance.</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * @return void</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    public <span class="function"><span class="keyword">function</span> <span class="title">__construct</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        parent::__construct();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * @throws \Exception</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    public <span class="function"><span class="keyword">function</span> <span class="title">handle</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        $path = $<span class="keyword">this</span>-&gt;argument(<span class="string">'path'</span>);</span><br><span class="line">        $option = $<span class="keyword">this</span>-&gt;option(<span class="string">'drive'</span>);</span><br><span class="line"></span><br><span class="line">        <span class="keyword">switch</span> ($option) &#123;</span><br><span class="line">            <span class="keyword">case</span> <span class="string">'laravel-excel'</span>:</span><br><span class="line">                $<span class="keyword">this</span>-&gt;useLaravelExcelDrive($path);</span><br><span class="line">                <span class="keyword">break</span>;</span><br><span class="line">            <span class="keyword">case</span> <span class="string">'spout'</span>:</span><br><span class="line">                $<span class="keyword">this</span>-&gt;useSpoutDrive($path);</span><br><span class="line">                <span class="keyword">break</span>;</span><br><span class="line">            <span class="keyword">default</span>:</span><br><span class="line">                <span class="keyword">throw</span> <span class="keyword">new</span> \Exception(<span class="string">'Invalid option '</span> . $option);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        $<span class="keyword">this</span>-&gt;info(sprintf(<span class="string">'共读取数据：%s 行'</span>, $<span class="keyword">this</span>-&gt;rows));</span><br><span class="line">        $<span class="keyword">this</span>-&gt;info(sprintf(<span class="string">'共耗时：%s秒'</span>, $<span class="keyword">this</span>-&gt;timeUsage));</span><br><span class="line">        $<span class="keyword">this</span>-&gt;info(sprintf(<span class="string">'共消耗内存: %sM'</span>, $<span class="keyword">this</span>-&gt;memoryUsage / <span class="number">1024</span> / <span class="number">1024</span>));</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    private <span class="function"><span class="keyword">function</span> <span class="title">useSpoutDrive</span>(<span class="params">$path</span>)</span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        ini_set(<span class="string">'memory_limit'</span>, <span class="number">-1</span>);</span><br><span class="line">        $start = now();</span><br><span class="line">        $reader = ReaderFactory::create(Type::XLSX);</span><br><span class="line">        $reader-&gt;setShouldFormatDates(<span class="literal">true</span>);</span><br><span class="line">        $reader-&gt;open(storage_path(<span class="string">'app/'</span>.$path));</span><br><span class="line">        $rows = [];</span><br><span class="line">        foreach ($reader-&gt;getSheetIterator() <span class="keyword">as</span> $sheet) &#123;</span><br><span class="line">            foreach ($sheet-&gt;getRowIterator() <span class="keyword">as</span> $row) &#123;</span><br><span class="line">                $<span class="keyword">this</span>-&gt;rows++;</span><br><span class="line">                $rows[] = $row;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        $<span class="keyword">this</span>-&gt;timeUsage = now()-&gt;diffInSeconds($start);</span><br><span class="line">        $<span class="keyword">this</span>-&gt;memoryUsage = xdebug_peak_memory_usage();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    private <span class="function"><span class="keyword">function</span> <span class="title">useLaravelExcelDrive</span>(<span class="params">$path</span>)</span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        $start = now();</span><br><span class="line">        Settings::setLibXmlLoaderOptions(LIBXML_COMPACT | LIBXML_PARSEHUGE);</span><br><span class="line">        ini_set(<span class="string">'memory_limit'</span>, <span class="number">-1</span>);</span><br><span class="line">        $array = Excel::toArray(<span class="keyword">new</span> TestImport(), $path);</span><br><span class="line">        $<span class="keyword">this</span>-&gt;rows = count($array[<span class="number">0</span>]);</span><br><span class="line">        $<span class="keyword">this</span>-&gt;timeUsage = now()-&gt;diffInSeconds($start);</span><br><span class="line">        $<span class="keyword">this</span>-&gt;memoryUsage = xdebug_peak_memory_usage();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line">php artisan make:<span class="keyword">import</span> TestImport</span><br><span class="line">&lt;?php</span><br><span class="line"></span><br><span class="line">namespace App\Imports;</span><br><span class="line"></span><br><span class="line">use Illuminate\Support\Collection;</span><br><span class="line">use Maatwebsite\Excel\Concerns\ToArray;</span><br><span class="line">use Maatwebsite\Excel\Concerns\ToCollection;</span><br><span class="line">use Maatwebsite\Excel\Concerns\WithChunkReading;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">TestImport</span></span></span><br><span class="line"><span class="class"></span>&#123;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line">php artisan excel:read public/test.xlsx</span><br><span class="line">php artisan excel:read public/test.xlsx --drive=spout</span><br></pre></td></tr></table></figure>
<h3 id="B-站直播实用脚本"><a href="#B-站直播实用脚本" class="headerlink" title="B 站直播实用脚本"></a>B 站直播实用脚本</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line">$ git clone https:<span class="comment">//github.com/metowolf/BilibiliHelper.git</span></span><br><span class="line">$ cd BilibiliHelper</span><br><span class="line">$ cp config.example config</span><br><span class="line">$ composer install</span><br><span class="line">$ php index.php</span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.DEBUG: POST: https:<span class="comment">//api.live.bilibili.com/User/userOnlineHeart</span></span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.DEBUG: &#123;<span class="string">"code"</span>:<span class="number">0</span>,<span class="string">"msg"</span>:<span class="string">"OK"</span>,<span class="string">"message"</span>:<span class="string">"OK"</span>,<span class="string">"data"</span>:&#123;<span class="string">"giftlist"</span>:[]&#125;&#125;</span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.INFO: 向直播间 <span class="number">3746256</span> 发送心跳包 (web)</span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.DEBUG: POST: https:<span class="comment">//api.live.bilibili.com/mobile/userOnlineHeart</span></span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.DEBUG: &#123;<span class="string">"code"</span>:<span class="number">0</span>,<span class="string">"msg"</span>:<span class="string">"OK"</span>,<span class="string">"message"</span>:<span class="string">"OK"</span>,<span class="string">"data"</span>:&#123;<span class="string">"giftlist"</span>:[]&#125;&#125;</span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.INFO: 向直播间 <span class="number">3746256</span> 发送心跳包 (APP)</span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.DEBUG: GET: https:<span class="comment">//api.live.bilibili.com/lottery/v1/SilverBox/getCurrentTask</span></span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.DEBUG: &#123;<span class="string">"code"</span>:<span class="number">0</span>,<span class="string">"msg"</span>:<span class="string">""</span>,<span class="string">"message"</span>:<span class="string">""</span>,<span class="string">"data"</span>:&#123;<span class="string">"minute"</span>:<span class="number">3</span>,<span class="string">"silver"</span>:<span class="number">30</span>,<span class="string">"time_start"</span>:<span class="number">1544594312</span>,<span class="string">"time_end"</span>:<span class="number">1544594492</span>,<span class="string">"times"</span>:<span class="number">1</span>,<span class="string">"max_times"</span>:<span class="number">3</span>&#125;&#125;</span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.NOTICE: 领取宝箱成功，内含 <span class="number">30</span> 个瓜子</span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.INFO: 等待 <span class="number">3</span> 分钟后打开宝箱</span><br><span class="line">[<span class="number">2018</span><span class="number">-12</span><span class="number">-12</span> <span class="number">13</span>:<span class="number">58</span>:<span class="number">33</span>] Bilibili.INFO: 检查每日任务</span><br><span class="line"># vi /usr/lib/systemd/system/bilibili.service</span><br><span class="line"></span><br><span class="line">[Unit]</span><br><span class="line">Description=Bilibili Helper Manager</span><br><span class="line">Documentation=https:<span class="comment">//github.com/metowolf/BilibiliHelper</span></span><br><span class="line">After=network.target</span><br><span class="line"></span><br><span class="line">[Service]</span><br><span class="line">ExecStart=<span class="regexp">/usr/</span>bin/php /root/BilibiliHelper/index.php</span><br><span class="line">Restart=always</span><br><span class="line"></span><br><span class="line">[Install]</span><br><span class="line">WantedBy=multi-user.target</span><br><span class="line"></span><br><span class="line">$ systemctl restart bilibili</span><br><span class="line">[root@VM_0_14_centos BilibiliHelper]# ps aux|grep bili|grep -v grep</span><br><span class="line">root      <span class="number">7987</span>  <span class="number">1.6</span>  <span class="number">1.0</span> <span class="number">317640</span> <span class="number">19012</span> ?        Ss   <span class="number">14</span>:<span class="number">03</span>   <span class="number">0</span>:<span class="number">00</span> /usr/bin/php /root/BilibiliHelper/index.php</span><br></pre></td></tr></table></figure>
<h3 id="XSS-Platform"><a href="#XSS-Platform" class="headerlink" title="XSS Platform"></a>XSS Platform</h3><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//https://laravel-china.org/articles/20815</span></span><br><span class="line">#git clone https://github.com/78778443/xssplatform.git</span><br><span class="line">#vi /etc/nginx/nginx.conf</span><br><span class="line">server &#123;</span><br><span class="line">    listen       <span class="number">80</span>;</span><br><span class="line">    server_name  xss.localhost;</span><br><span class="line">    root  /Users/song/mycode/safe/xssplatform/;</span><br><span class="line"></span><br><span class="line">    rewrite <span class="string">"^/([0-9a-zA-Z]&#123;6&#125;)$"</span> /index.php?<span class="keyword">do</span>=code&amp;urlKey=$<span class="number">1</span> last;</span><br><span class="line">    rewrite <span class="string">"^/do/auth/(\w+?)(/domain/([\w\.]+?))?$"</span> /index.php?<span class="keyword">do</span>=<span class="keyword">do</span>&amp;auth=$<span class="number">1</span>&amp;domain=$<span class="number">3</span> last;</span><br><span class="line">    rewrite <span class="string">"^/register/(.*?)$"</span> /index.php?<span class="keyword">do</span>=register&amp;key=$<span class="number">1</span> last;</span><br><span class="line">    rewrite <span class="string">"^/register-validate/(.*?)$"</span> /index.php?<span class="keyword">do</span>=register&amp;act=validate&amp;key=$<span class="number">1</span> last;</span><br><span class="line"></span><br><span class="line">    location / &#123;</span><br><span class="line"></span><br><span class="line">        index index.html index.htm index.php;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    location ~ \.php$ &#123;</span><br><span class="line">        fastcgi_pass   <span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span>:<span class="number">9000</span>;</span><br><span class="line">        fastcgi_index  index.php;</span><br><span class="line">        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;</span><br><span class="line">        include        fastcgi_params;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line">#nginx -s reload</span><br></pre></td></tr></table></figure>
<h3 id="生成小程序图文海报"><a href="#生成小程序图文海报" class="headerlink" title="生成小程序图文海报"></a>生成小程序图文海报</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">https:<span class="comment">//laravel-china.org/articles/18418</span></span><br><span class="line">composer <span class="built_in">require</span> ibrand/laravel-miniprogram-poster </span><br><span class="line">低于 Laravel5<span class="number">.5</span> 版本，config/app.php 文件中 <span class="string">'providers'</span> 添加iBrand\Poster\PhantoMmagickServiceProvider::<span class="class"><span class="keyword">class</span></span></span><br><span class="line"><span class="class"></span></span><br><span class="line">图片保存在 storage/app/public 下所以需要执行 php artisan storage:link</span><br><span class="line"></span><br><span class="line">如需自定义配置请执行 php artisan vendor:publish --provider=<span class="string">"iBrand\Poster\PhantoMmagickServiceProvider"</span> --tag=<span class="string">"config"</span></span><br><span class="line"></span><br><span class="line">use iBrand\Miniprogram\Poster\MiniProgramShareImg;</span><br><span class="line"></span><br><span class="line">$url = <span class="string">'https://www.ibrand.cc/'</span>;</span><br><span class="line">$result = MiniProgramShareImg::generateShareImage($url);</span><br></pre></td></tr></table></figure>
<h3 id="HTML-导出-PDF"><a href="#HTML-导出-PDF" class="headerlink" title="HTML 导出 PDF"></a>HTML 导出 PDF</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//https://laravel-china.org/articles/21905 https://github.com/niklasravnsborg/laravel-pdf</span></span><br><span class="line">下载 https:<span class="comment">//wkhtmltopdf.org/downloads.html</span></span><br><span class="line">wkhtmltopdf https:<span class="comment">//www.baidu.com 1.pdf</span></span><br><span class="line">$ wkhtmltopdf.exe --lowquality <span class="string">"http://www.baidu.com"</span> baidu.pdf</span><br><span class="line">Loading pages (<span class="number">1</span>/<span class="number">6</span>)</span><br><span class="line">libpng warning: iCCP: known incorrect sRGB profile           ] <span class="number">35</span>%</span><br><span class="line">libpng warning: iCCP: known incorrect sRGB profile           ] <span class="number">41</span>%</span><br><span class="line">libpng warning: iCCP: known incorrect sRGB profile           ] <span class="number">46</span>%</span><br><span class="line">Counting pages (<span class="number">2</span>/<span class="number">6</span>)</span><br><span class="line">Resolving links (<span class="number">4</span>/<span class="number">6</span>)</span><br><span class="line">Loading headers and footers (<span class="number">5</span>/<span class="number">6</span>)</span><br><span class="line">Printing pages (<span class="number">6</span>/<span class="number">6</span>)</span><br><span class="line">Done</span><br><span class="line"></span><br><span class="line">composer <span class="built_in">require</span> barryvdh/laravel-snappy</span><br><span class="line"></span><br><span class="line">将ServiceProvider添加到config / app.php中的providers数组</span><br><span class="line">Barryvdh\Snappy\ServiceProvider::<span class="class"><span class="keyword">class</span>,</span></span><br><span class="line"><span class="class"></span></span><br><span class="line"><span class="class">添加<span class="title">facade</span>到<span class="title">config</span> / <span class="title">app</span>.<span class="title">php</span>中的<span class="title">aliases</span>数组中</span></span><br><span class="line"><span class="class">'<span class="title">PDF</span>' </span>=&gt; Barryvdh\Snappy\Facades\SnappyPdf::<span class="class"><span class="keyword">class</span>,</span></span><br><span class="line"><span class="class">'<span class="title">SnappyImage</span>' </span>=&gt; Barryvdh\Snappy\Facades\SnappyImage::<span class="class"><span class="keyword">class</span>,</span></span><br><span class="line"><span class="class"></span></span><br><span class="line"><span class="class">生成配置文件</span></span><br><span class="line">php artisan vendor:publish --provider="Barryvdh\Snappy\ServiceProvider"</span><br><span class="line">vi config/snappy.php</span><br><span class="line">binary=&gt;<span class="string">'D:\laragon\www\source\wkhtmltopdf\bin\wkhtmltopdf.exe'</span></span><br><span class="line"># 下载</span><br><span class="line">$pdf = \PDF::loadView(<span class="string">'welcome'</span>, $data);</span><br><span class="line"><span class="keyword">return</span> $pdf-&gt;download(<span class="string">'welcome.pdf'</span>);</span><br><span class="line"></span><br><span class="line"># 渲染页面</span><br><span class="line">$html = <span class="string">'&lt;html&gt;&lt;head&gt;&lt;meta charset="utf-8"&gt;&lt;/head&gt;&lt;h1&gt;订单id&lt;/h1&gt;&lt;h2&gt;12346546&lt;/h2&gt;&lt;/html&gt;'</span>;</span><br><span class="line">$pdf = \PDF::loadHTML($html);</span><br><span class="line"><span class="keyword">return</span> $pdf-&gt;inline();</span><br><span class="line"></span><br><span class="line">$pdf = \App::make(<span class="string">'snappy.pdf.wrapper'</span>);</span><br><span class="line">$pdf-&gt;loadHTML(<span class="string">'&lt;h1&gt;Test&lt;/h1&gt;'</span>);</span><br><span class="line"><span class="keyword">return</span> $pdf-&gt;inline();</span><br><span class="line"></span><br><span class="line"><span class="keyword">return</span> PDF::loadFile(<span class="string">'http://www.github.com'</span>)-&gt;inline(<span class="string">'github.pdf'</span>);</span><br><span class="line">$snappy = \App::make(<span class="string">'snappy.pdf'</span>);</span><br><span class="line"><span class="comment">//To file</span></span><br><span class="line">$html = <span class="string">'&lt;h1&gt;Bill&lt;/h1&gt;&lt;p&gt;You owe me money, dude.&lt;/p&gt;'</span>;</span><br><span class="line">$snappy-&gt;generateFromHtml($html, <span class="string">'/tmp/bill-123.pdf'</span>);</span><br><span class="line">$snappy-&gt;generate(<span class="string">'http://www.github.com'</span>, <span class="string">'/tmp/github.pdf'</span>);</span><br><span class="line"></span><br><span class="line">#门面（facade）加载HTML字符串、文件或者视图</span><br><span class="line">#stream()方法显示在浏览器中</span><br><span class="line">#save()方法保存到文件</span><br><span class="line">#download()方法下载</span><br><span class="line"></span><br><span class="line">$pdf = PDF::loadView(<span class="string">'pdf.invoice'</span>, $data);</span><br><span class="line"><span class="keyword">return</span> $pdf-&gt;download(<span class="string">'invoice.pdf'</span>);</span><br><span class="line"></span><br><span class="line">#链式操作</span><br><span class="line"><span class="keyword">return</span> PDF::loadFile(<span class="string">'file.html'</span>)-&gt;save(<span class="string">'file.pdf'</span>)-&gt;stream(<span class="string">'download.pdf'</span>);</span><br><span class="line"></span><br><span class="line">#方向</span><br><span class="line">PDF::loadHTML($html)-&gt;setPaper(<span class="string">'a4'</span>, <span class="string">'landscape'</span>)-&gt;setWarnings(<span class="literal">false</span>)-&gt;save(<span class="string">'file.pdf'</span>)</span><br><span class="line"></span><br><span class="line">#生成图片</span><br><span class="line">$pdf = SnappyImage::loadView(<span class="string">'pdf.invoice'</span>, $data);</span><br><span class="line"><span class="keyword">return</span> $pdf-&gt;download(<span class="string">'invoice.image'</span>);</span><br><span class="line">https:<span class="comment">//php1024.com/posts/45.htm</span></span><br></pre></td></tr></table></figure>
<h3 id="zip"><a href="#zip" class="headerlink" title="zip"></a>zip</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//https://laravel-china.org/topics/21368</span></span><br><span class="line">composer <span class="built_in">require</span> chumper/zipper</span><br><span class="line">$zipper = <span class="keyword">new</span> \Chumper\Zipper\Zipper;</span><br><span class="line"><span class="comment">// https://github.com/Chumper/Zipper https://github.com/Ne-Lexa/php-zip</span></span><br><span class="line">$zipper-&gt;make(<span class="string">'test.zip'</span>)-&gt;folder(<span class="string">'test'</span>)-&gt;add(<span class="string">'composer.json'</span>);</span><br><span class="line">$zipper-&gt;zip(<span class="string">'test.zip'</span>)-&gt;folder(<span class="string">'test'</span>)-&gt;add(<span class="string">'composer.json'</span>,<span class="string">'test'</span>);</span><br><span class="line"></span><br><span class="line">$zipper-&gt;remove(<span class="string">'composer.lock'</span>);</span><br><span class="line"></span><br><span class="line">$zipper-&gt;folder(<span class="string">'mySuperPackage'</span>)-&gt;add(</span><br><span class="line">    array(</span><br><span class="line">        <span class="string">'vendor'</span>,</span><br><span class="line">        <span class="string">'composer.json'</span></span><br><span class="line">    ),</span><br><span class="line">);</span><br><span class="line"></span><br><span class="line">$zipper-&gt;getFileContent(<span class="string">'mySuperPackage/composer.json'</span>);</span><br><span class="line"></span><br><span class="line">$zipper-&gt;make(<span class="string">'test.zip'</span>)-&gt;extractTo(<span class="string">''</span>,array(<span class="string">'mySuperPackage/composer.json'</span>),<span class="attr">Zipper</span>::WHITELIST);</span><br><span class="line"></span><br><span class="line">$zipper-&gt;close();</span><br></pre></td></tr></table></figure>
<h3 id="Walle-瓦力上线部署系统正确安装"><a href="#Walle-瓦力上线部署系统正确安装" class="headerlink" title="Walle-瓦力上线部署系统正确安装"></a>Walle-瓦力上线部署系统正确安装</h3><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">https:<span class="comment">//www.phpsong.com/2166.html</span></span><br><span class="line">mkdir -p /data/www/walle-web &amp;&amp; cd /data/www/walle-web # 新建目录</span><br><span class="line">git clone git@github.com:meolu/walle-web.git . # 代码检出</span><br></pre></td></tr></table></figure>
<h3 id="api文档swagger"><a href="#api文档swagger" class="headerlink" title="api文档swagger"></a>api文档swagger</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//https://github.com/zircote/swagger-php</span></span><br><span class="line">$ composer global <span class="built_in">require</span> zircote/swagger-php</span><br><span class="line">Changed current directory to C:<span class="regexp">/Users/</span>suping3/AppData/Roaming/Composer</span><br><span class="line">    <span class="number">1</span>/<span class="number">2</span>:        https:<span class="comment">//packagist.laravel-china.org/p/provider-latest$37c8735b09b76040c9a255538c478903f6395d36efb59ce8ad13018c0e87dea7.json</span></span><br><span class="line">    <span class="number">2</span>/<span class="number">2</span>:        https:<span class="comment">//packagist.laravel-china.org/p/provider-2018-10$6a20a9e7d4e44c231d13cc94ff3b58d88abbec0d6ca0a8aa8e2178d4569d0ea4.json</span></span><br><span class="line">    Finished: success: <span class="number">2</span>, <span class="attr">skipped</span>: <span class="number">0</span>, <span class="attr">failure</span>: <span class="number">0</span>, <span class="attr">total</span>: <span class="number">2</span></span><br><span class="line">Using version ^<span class="number">3.0</span> <span class="keyword">for</span> zircote/swagger-php</span><br><span class="line">./composer.json has been updated</span><br><span class="line">Loading composer repositories <span class="keyword">with</span> package information</span><br><span class="line">Updating dependencies (including <span class="built_in">require</span>-dev)</span><br><span class="line">Package operations: <span class="number">1</span> install, <span class="number">0</span> updates, <span class="number">0</span> removals</span><br><span class="line">  - Installing zircote/swagger-php (<span class="number">3.0</span><span class="number">.2</span>): Loading <span class="keyword">from</span> cache</span><br><span class="line">Writing lock file</span><br><span class="line">Generating autoload files</span><br><span class="line"></span><br><span class="line">suping3@BJ-D<span class="number">-212361</span>A MINGW64 /d/php_study/PHPTutorial/WWW/laravel</span><br><span class="line">$ vendor/bin/openapi --help</span><br><span class="line"></span><br><span class="line">Usage: openapi [--option value] [<span class="regexp">/path/</span>to/project ...]</span><br><span class="line"></span><br><span class="line">Options:</span><br><span class="line">  --output (-o)     Path to store the generated documentation.</span><br><span class="line">                    ex: --output openapi.yaml</span><br><span class="line">  --exclude (-e)    Exclude path(s).</span><br><span class="line">                    ex: --exclude vendor,library/Zend</span><br><span class="line">  --bootstrap (-b)  Bootstrap a php file <span class="keyword">for</span> defining constants, etc.</span><br><span class="line">                    ex: --bootstrap config/constants.php</span><br><span class="line">  --processor       Register an additional processor.</span><br><span class="line">  --format          Force yaml or json.</span><br><span class="line">  --debug           Show additional error information.</span><br><span class="line">  --help (-h)       Display <span class="keyword">this</span> help message.</span><br></pre></td></tr></table></figure>
<h3 id="手机上利用PHP完成对电脑的操作"><a href="#手机上利用PHP完成对电脑的操作" class="headerlink" title="手机上利用PHP完成对电脑的操作"></a>手机上利用PHP完成对电脑的操作</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//http://www.helpergarden.com/2014/03/%e5%9c%a8%e6%89%8b%e6%9c%ba%e4%b8%8a%e5%88%a9%e7%94%a8php%e5%ae%8c%e6%88%90%e5%af%b9%e7%94%b5%e8%84%91%e7%9a%84%e6%93%8d%e4%bd%9c.html</span></span><br><span class="line">&lt;meta http-equiv=<span class="string">"Content-Type"</span> content=<span class="string">"text/html; charset=utf-8"</span>/&gt;</span><br><span class="line">&lt;style&gt;</span><br><span class="line">    a&#123;font-size: <span class="number">32</span>px;&#125;</span><br><span class="line">&lt;<span class="regexp">/style&gt;</span></span><br><span class="line"><span class="regexp">&lt;a href="?type=cancle"&gt;取消关机&lt;/</span>a&gt;</span><br><span class="line">&lt;br&gt;&lt;br&gt;</span><br><span class="line">&lt;a href="?type=close"&gt;关机&lt;/a&gt;</span><br><span class="line">&lt;?php</span><br><span class="line">$type=isset($_GET['type'])?$_GET['type']:false;</span><br><span class="line">$cmd='';</span><br><span class="line">switch ($type)&#123;</span><br><span class="line">    case 'cancle':</span><br><span class="line">        $cmd="shutdown -a";</span><br><span class="line">        break;</span><br><span class="line">    case 'close':</span><br><span class="line">        $cmd="shutdown -f -s -t 120";</span><br><span class="line">        break;</span><br><span class="line">    default:</span><br><span class="line">        $cmd='';</span><br><span class="line">        break;</span><br><span class="line">&#125;</span><br><span class="line">if(!empty($cmd))    </span><br><span class="line">exec($cmd);</span><br><span class="line">?&gt;</span><br></pre></td></tr></table></figure>
<h3 id="隐藏你的-ID"><a href="#隐藏你的-ID" class="headerlink" title="隐藏你的 ID"></a>隐藏你的 ID</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//https://laravel-china.org/articles/18335</span></span><br><span class="line">composer <span class="built_in">require</span> <span class="number">96</span>qbhy/hyid</span><br><span class="line">php artisan vendor:publish --provider=Qbhy\Hyid\ServiceProvider</span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">User</span> <span class="keyword">extends</span> <span class="title">Model</span></span>&#123;</span><br><span class="line">    use Qbhy\Hyid\HyidAble;</span><br><span class="line"></span><br><span class="line">    <span class="comment">// or </span></span><br><span class="line">    public <span class="function"><span class="keyword">function</span> <span class="title">getUserId</span>(<span class="params">$userId</span>)</span>&#123;</span><br><span class="line">        <span class="keyword">return</span> hyid($userId);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">// or</span></span><br><span class="line">    public <span class="function"><span class="keyword">function</span> <span class="title">toArray</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">        $data = parent::toArray();</span><br><span class="line"></span><br><span class="line">        $data[<span class="string">'id'</span>] = hyid()-&gt;encode($data[<span class="string">'id'</span>])</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span> $data;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// decode</span></span><br><span class="line">    public <span class="function"><span class="keyword">function</span> <span class="title">userinfo</span>(<span class="params">$id</span>)</span>&#123;</span><br><span class="line">        <span class="keyword">return</span> User::query()-&gt;findOrFail(hyid()-&gt;decode($id))-&gt;toArray();</span><br><span class="line">    &#125;</span><br><span class="line"><span class="comment">// 非 laravel or lumen 下，可以自行实例化 Hyid 类</span></span><br><span class="line">$secret = <span class="string">'qbhy'</span>;</span><br><span class="line">$offset = <span class="number">1996</span>;</span><br><span class="line">$randomLength = <span class="number">6</span>;</span><br><span class="line">$hyid = <span class="keyword">new</span> Hyid($secret,$offset,$randomLength);</span><br><span class="line"></span><br><span class="line">$encodedId = $hyid-&gt;encode(<span class="number">1</span>);</span><br><span class="line">$id = $hyid-&gt;decode($encodedId);</span><br></pre></td></tr></table></figure>
<h3 id="书童机器人"><a href="#书童机器人" class="headerlink" title="书童机器人"></a>书童机器人</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">https:<span class="comment">//laravel-china.org/articles/6429/lang-jelly-robot-chat-with-you</span></span><br><span class="line">$ git clone https:<span class="comment">//github.com/jormin/robot.git</span></span><br><span class="line">$ composer install</span><br><span class="line">$ cd /path/to/robot</span><br><span class="line">$ cp .env.example .env</span><br><span class="line">$ php artisan key:generate</span><br></pre></td></tr></table></figure>
<h3 id="格式化sql"><a href="#格式化sql" class="headerlink" title="格式化sql"></a>格式化sql</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">require_once(<span class="string">'SqlFormatter.php'</span>);</span><br><span class="line"><span class="comment">//https://github.com/jdorn/sql-formatter/blob/master/lib/SqlFormatter.php</span></span><br><span class="line">$query = <span class="string">"SELECT count(*),`Column1`,`Testing`, `Testing Three` FROM `Table1`</span></span><br><span class="line"><span class="string">    WHERE Column1 = 'testing' AND ( (`Column2` = `Column3` OR Column4 &gt;= NOW()) )</span></span><br><span class="line"><span class="string">    GROUP BY Column1 ORDER BY Column3 DESC LIMIT 5,10"</span>;</span><br><span class="line"></span><br><span class="line">echo SqlFormatter::format($query);</span><br><span class="line">echo SqlFormatter::format($query, <span class="literal">false</span>);</span><br><span class="line">echo SqlFormatter::compress($query);</span><br></pre></td></tr></table></figure>
<h3 id="jwt"><a href="#jwt" class="headerlink" title="jwt"></a>jwt</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br></pre></td><td class="code"><pre><span class="line">&lt;?php</span><br><span class="line">namespace App;</span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">JwtBase</span> </span>&#123;</span><br><span class="line">    <span class="comment">//头部</span></span><br><span class="line">    private <span class="keyword">static</span> $header=array(</span><br><span class="line">        <span class="string">'alg'</span>=&gt;<span class="string">'HS256'</span>, <span class="comment">//生成signature的算法</span></span><br><span class="line">        <span class="string">'typ'</span>=&gt;<span class="string">'JWT'</span>  <span class="comment">//类型</span></span><br><span class="line">    );</span><br><span class="line">    <span class="comment">//使用HMAC生成信息摘要时所使用的密钥</span></span><br><span class="line">    private <span class="keyword">static</span> $key=<span class="string">'KEY'</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 获取jwt token</span></span><br><span class="line"><span class="comment">     * @param array $payload jwt载荷  格式如下非必须</span></span><br><span class="line"><span class="comment">     * [</span></span><br><span class="line"><span class="comment">     * 'iss'=&gt;'jwt_admin', //该JWT的签发者</span></span><br><span class="line"><span class="comment">     * 'iat'=&gt;time(), //签发时间</span></span><br><span class="line"><span class="comment">     * 'exp'=&gt;time()+7200, //过期时间</span></span><br><span class="line"><span class="comment">     * 'nbf'=&gt;time()+60, //该时间之前不接收处理该Token</span></span><br><span class="line"><span class="comment">     * 'sub'=&gt;'www.admin.com', //面向的用户</span></span><br><span class="line"><span class="comment">     * 'jti'=&gt;md5(uniqid('JWT').time()) //该Token唯一标识</span></span><br><span class="line"><span class="comment">     * ]</span></span><br><span class="line"><span class="comment">     * @return bool|string</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    public <span class="keyword">static</span> <span class="function"><span class="keyword">function</span> <span class="title">getToken</span>(<span class="params">array $payload</span>)</span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        $arr = [</span><br><span class="line">            <span class="string">'iss'</span>=&gt;<span class="string">'yamecent'</span>, <span class="comment">//该JWT的签发者</span></span><br><span class="line">            <span class="string">'iat'</span>=&gt;time(), <span class="comment">//签发时间</span></span><br><span class="line">            <span class="string">'exp'</span>=&gt;time()+<span class="number">3600</span>*<span class="number">24</span>*<span class="number">15</span>, <span class="comment">//过期时间</span></span><br><span class="line">            <span class="string">'nbf'</span>=&gt;time(), <span class="comment">//该时间之前不接收处理该Token</span></span><br><span class="line">            <span class="string">'sub'</span>=&gt;<span class="string">''</span>, <span class="comment">//面向的用户</span></span><br><span class="line">            <span class="string">'jti'</span>=&gt;md5(uniqid(<span class="string">'JWT'</span>).time()) <span class="comment">//该Token唯一标识</span></span><br><span class="line">        ];</span><br><span class="line">        $payload = array_merge($arr,$payload);</span><br><span class="line">        <span class="keyword">if</span>(is_array($payload))</span><br><span class="line">        &#123;</span><br><span class="line">            $base64header=self::base64UrlEncode(json_encode(self::$header,JSON_UNESCAPED_UNICODE));</span><br><span class="line">            $base64payload=self::base64UrlEncode(json_encode($payload,JSON_UNESCAPED_UNICODE));</span><br><span class="line">            $token=$base64header.<span class="string">'.'</span>.$base64payload.<span class="string">'.'</span>.self::signature($base64header.<span class="string">'.'</span>.$base64payload,<span class="attr">self</span>::$key,<span class="attr">self</span>::$header[<span class="string">'alg'</span>]);</span><br><span class="line">            <span class="keyword">return</span> $token;</span><br><span class="line">        &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">            <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 验证token是否有效,默认验证exp,nbf,iat时间</span></span><br><span class="line"><span class="comment">     * @param string $Token 需要验证的token</span></span><br><span class="line"><span class="comment">     * @return bool|string</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    public <span class="keyword">static</span> <span class="function"><span class="keyword">function</span> <span class="title">verifyToken</span>(<span class="params">string $Token</span>)</span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        $tokens = explode(<span class="string">'.'</span>, $Token);</span><br><span class="line">        <span class="keyword">if</span> (count($tokens) != <span class="number">3</span>)</span><br><span class="line">            <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"></span><br><span class="line">        list($base64header, $base64payload, $sign) = $tokens;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//获取jwt算法</span></span><br><span class="line">        $base64decodeheader = json_decode(self::base64UrlDecode($base64header), JSON_OBJECT_AS_ARRAY);</span><br><span class="line">        <span class="keyword">if</span> (empty($base64decodeheader[<span class="string">'alg'</span>]))</span><br><span class="line">            <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//签名验证</span></span><br><span class="line">        <span class="keyword">if</span> (self::signature($base64header . <span class="string">'.'</span> . $base64payload, <span class="attr">self</span>::$key, $base64decodeheader[<span class="string">'alg'</span>]) !== $sign)</span><br><span class="line">            <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"></span><br><span class="line">        $payload = json_decode(self::base64UrlDecode($base64payload), JSON_OBJECT_AS_ARRAY);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//签发时间大于当前服务器时间验证失败</span></span><br><span class="line">        <span class="keyword">if</span> (isset($payload[<span class="string">'iat'</span>]) &amp;&amp; $payload[<span class="string">'iat'</span>] &gt; time())</span><br><span class="line">            <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//过期时间小宇当前服务器时间验证失败</span></span><br><span class="line">        <span class="keyword">if</span> (isset($payload[<span class="string">'exp'</span>]) &amp;&amp; $payload[<span class="string">'exp'</span>] &lt; time())</span><br><span class="line">            <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//该nbf时间之前不接收处理该Token</span></span><br><span class="line">        <span class="keyword">if</span> (isset($payload[<span class="string">'nbf'</span>]) &amp;&amp; $payload[<span class="string">'nbf'</span>] &gt; time())</span><br><span class="line">            <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span> $payload;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * base64UrlEncode  https://jwt.io/ 中base64UrlEncode编码实现</span></span><br><span class="line"><span class="comment">     * @param string $input 需要编码的字符串</span></span><br><span class="line"><span class="comment">     * @return string</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    private <span class="keyword">static</span> <span class="function"><span class="keyword">function</span> <span class="title">base64UrlEncode</span>(<span class="params">string $input</span>)</span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> str_replace(<span class="string">'='</span>, <span class="string">''</span>, strtr(base64_encode($input), <span class="string">'+/'</span>, <span class="string">'-_'</span>));</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * base64UrlEncode https://jwt.io/ 中base64UrlEncode解码实现</span></span><br><span class="line"><span class="comment">     * @param string $input 需要解码的字符串</span></span><br><span class="line"><span class="comment">     * @return bool|string</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    private <span class="keyword">static</span> <span class="function"><span class="keyword">function</span> <span class="title">base64UrlDecode</span>(<span class="params">string $input</span>)</span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        $remainder = strlen($input) % <span class="number">4</span>;</span><br><span class="line">        <span class="keyword">if</span> ($remainder) &#123;</span><br><span class="line">            $addlen = <span class="number">4</span> - $remainder;</span><br><span class="line">            $input .= str_repeat(<span class="string">'='</span>, $addlen);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> base64_decode(strtr($input, <span class="string">'-_'</span>, <span class="string">'+/'</span>));</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * HMACSHA256签名  https://jwt.io/ 中HMACSHA256签名实现</span></span><br><span class="line"><span class="comment">     * @param string $input 为base64UrlEncode(header).".".base64UrlEncode(payload)</span></span><br><span class="line"><span class="comment">     * @param string $key</span></span><br><span class="line"><span class="comment">     * @param string $alg  算法方式</span></span><br><span class="line"><span class="comment">     * @return mixed</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    private <span class="keyword">static</span> <span class="function"><span class="keyword">function</span> <span class="title">signature</span>(<span class="params">string $input, string $key, string $alg = <span class="string">'HS256'</span></span>)</span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        $alg_config=array(</span><br><span class="line">            <span class="string">'HS256'</span>=&gt;<span class="string">'sha256'</span></span><br><span class="line">        );</span><br><span class="line">        <span class="keyword">return</span> self::base64UrlEncode(hash_hmac($alg_config[$alg], $input, $key,<span class="literal">true</span>));</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line">$token = \App\JwtBase::getToken([<span class="string">'user_id'</span>=&gt;<span class="number">666</span>]);<span class="comment">//生成token</span></span><br><span class="line">	$data = \App\JwtBase::verifyToken($token);</span><br><span class="line">	dump($data);</span><br><span class="line">	array:<span class="number">7</span> [▼</span><br><span class="line">      <span class="string">"iss"</span> =&gt; <span class="string">"yamecent"</span></span><br><span class="line">      <span class="string">"iat"</span> =&gt; <span class="number">1547186866</span></span><br><span class="line">      <span class="string">"exp"</span> =&gt; <span class="number">1548482866</span></span><br><span class="line">      <span class="string">"nbf"</span> =&gt; <span class="number">1547186866</span></span><br><span class="line">      <span class="string">"sub"</span> =&gt; <span class="string">""</span></span><br><span class="line">      <span class="string">"jti"</span> =&gt; <span class="string">"fbb7cbfd4f962dfb6ff193e28f09b6e2"</span></span><br><span class="line">      <span class="string">"user_id"</span> =&gt; <span class="number">666</span></span><br><span class="line">    ]</span><br></pre></td></tr></table></figure>
<h3 id="php版为所欲为"><a href="#php版为所欲为" class="headerlink" title="php版为所欲为"></a>php版为所欲为</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br></pre></td><td class="code"><pre><span class="line"># 安装 epel 库，如果以前装过可以不用</span><br><span class="line">yum install -y epel-release</span><br><span class="line"></span><br><span class="line"># 引入 nux.ro 的库</span><br><span class="line">rpm --<span class="keyword">import</span> http:<span class="comment">//li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro  </span></span><br><span class="line">rpm -Uvh http:<span class="comment">//li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm</span></span><br><span class="line"></span><br><span class="line"># 执行安装</span><br><span class="line">yum install ffmpeg</span><br><span class="line"></span><br><span class="line">摘抄自：https:<span class="comment">//sendya.me/centos-yum-install-ffmpeg-lib/</span></span><br><span class="line">安装字体 https:<span class="comment">//blog.csdn.net/wlwlwlwl015/article/details/51482065</span></span><br><span class="line">git clone https:<span class="comment">//github.com/PrintNow/php-sorry-gif</span></span><br><span class="line">cd php-sorry-gif</span><br><span class="line">ps aux |grep fpm </span><br><span class="line">chown -R nobody:nobody /usr/share/nginx/html/php-sorry-gif/</span><br><span class="line">访问 http:<span class="comment">//118.24.158.116:8888/php-sorry-gif/index.php#weisuoyuwei</span></span><br><span class="line"></span><br><span class="line">js 版</span><br><span class="line">$ git clone https:<span class="comment">//github.com/WincerChan/Meme-generator</span></span><br><span class="line">Cloning into <span class="string">'Meme-generator'</span>...</span><br><span class="line">remote: Enumerating objects: <span class="number">30</span>, done.</span><br><span class="line">remote: Counting objects: <span class="number">100</span>% (<span class="number">30</span>/<span class="number">30</span>), done.</span><br><span class="line">remote: Compressing objects: <span class="number">100</span>% (<span class="number">23</span>/<span class="number">23</span>), done.</span><br><span class="line">remote: Total <span class="number">488</span> (delta <span class="number">13</span>), reused <span class="number">22</span> (delta <span class="number">7</span>), pack-reused <span class="number">458</span></span><br><span class="line">Receiving objects: <span class="number">100</span>% (<span class="number">488</span>/<span class="number">488</span>), <span class="number">7.50</span> MiB | <span class="number">545.00</span> KiB/s, done.</span><br><span class="line">Resolving deltas: <span class="number">100</span>% (<span class="number">280</span>/<span class="number">280</span>), done.</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">$ cd Meme-generator/</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">$ yarn install</span><br><span class="line">yarn install v1<span class="number">.9</span><span class="number">.4</span></span><br><span class="line">[<span class="number">1</span>/<span class="number">4</span>] Resolving packages...</span><br><span class="line">[<span class="number">2</span>/<span class="number">4</span>] Fetching packages...</span><br><span class="line">info fsevents@<span class="number">1.2</span><span class="number">.4</span>: The platform <span class="string">"win32"</span> is incompatible <span class="keyword">with</span> <span class="keyword">this</span> <span class="built_in">module</span>.</span><br><span class="line">info <span class="string">"fsevents@1.2.4"</span> is an optional dependency and failed compatibility check. Excluding it <span class="keyword">from</span> installation.</span><br><span class="line">[<span class="number">3</span>/<span class="number">4</span>] Linking dependencies...</span><br><span class="line">[<span class="number">4</span>/<span class="number">4</span>] Building fresh packages...</span><br><span class="line">Done <span class="keyword">in</span> <span class="number">50.18</span>s.</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">$ yarn start</span><br><span class="line">yarn run v1<span class="number">.9</span><span class="number">.4</span></span><br><span class="line">$ react-scripts start</span><br><span class="line">Starting the development server...</span><br><span class="line"></span><br><span class="line">Compiled successfully!</span><br><span class="line"></span><br><span class="line">You can now view meme <span class="keyword">in</span> the browser.</span><br><span class="line"></span><br><span class="line">  Local:            http:<span class="comment">//localhost:3000/</span></span><br><span class="line">  On Your Network:  http:<span class="comment">//10.235.51.40:3000/</span></span><br><span class="line"></span><br><span class="line">Note that the development build is not optimized.</span><br><span class="line">To create a production build, use yarn build.</span><br><span class="line"></span><br><span class="line">python 版</span><br><span class="line"></span><br><span class="line">$ pip install flask pillow imageio ffmpeg-python moviepy</span><br><span class="line">Requirement already satisfied: flask <span class="keyword">in</span> d:\python\lib\site-packages (<span class="number">0.12</span><span class="number">.4</span>)</span><br><span class="line">Collecting pillow</span><br><span class="line">  Downloading https:<span class="comment">//files.pythonhosted.org/packages/d7/ea/46fd5bd57c5df5a2e79e508294acec4be0fcc2fb3ce95c2cf1038ebaa533/Pillow-5.4.1-cp37-cp37m-win32.whl (1.7MB)</span></span><br><span class="line">Collecting imageio</span><br><span class="line">  Downloading https:<span class="comment">//files.pythonhosted.org/packages/28/b4/cbb592964dfd71a9de6a5b08f882fd334fb99ae09ddc82081dbb2f718c81/imageio-2.4.1.tar.gz (3.3MB)</span></span><br><span class="line">Collecting ffmpeg-python</span><br><span class="line">  Downloading https:<span class="comment">//files.pythonhosted.org/packages/3d/10/330cbc8e63d072d40413f4d470444a6a1e8c8c6a80b2a4ac302d1252ca1b/ffmpeg_python-0.1.17-py3-none-any.whl</span></span><br><span class="line">Collecting moviepy</span><br><span class="line">  Downloading https:<span class="comment">//files.pythonhosted.org/packages/1f/af/98b68b047c47d9430cb4c9ac899cf9d969de3936f888072991ea74da93a8/moviepy-0.2.3.5.tar.gz (372kB)</span></span><br><span class="line">Requirement already satisfied: click&gt;=<span class="number">2.0</span> <span class="keyword">in</span> d:\python\lib\site-packages (<span class="keyword">from</span> flask) (<span class="number">6.7</span>)</span><br><span class="line">Requirement already satisfied: Jinja2&gt;=<span class="number">2.4</span> <span class="keyword">in</span> d:\python\lib\site-packages (<span class="keyword">from</span> flask) (<span class="number">2.10</span>)</span><br><span class="line">Requirement already satisfied: Werkzeug&gt;=<span class="number">0.7</span> <span class="keyword">in</span> d:\python\lib\site-packages (<span class="keyword">from</span> flask) (<span class="number">0.14</span><span class="number">.1</span>)</span><br><span class="line">Requirement already satisfied: itsdangerous&gt;=<span class="number">0.21</span> <span class="keyword">in</span> d:\python\lib\site-packages (<span class="keyword">from</span> flask) (<span class="number">0.24</span>)</span><br><span class="line">Requirement already satisfied: numpy <span class="keyword">in</span> d:\python\lib\site-packages (<span class="keyword">from</span> imageio) (<span class="number">1.15</span><span class="number">.1</span>)</span><br><span class="line">Requirement already satisfied: future <span class="keyword">in</span> d:\python\lib\site-packages (<span class="keyword">from</span> ffmpeg-python) (<span class="number">0.16</span><span class="number">.0</span>)</span><br><span class="line">Requirement already satisfied: decorator&lt;<span class="number">5.0</span>,&gt;=<span class="number">4.0</span><span class="number">.2</span> <span class="keyword">in</span> d:\python\lib\site-packages (<span class="keyword">from</span> moviepy) (<span class="number">4.3</span><span class="number">.0</span>)</span><br><span class="line">Collecting tqdm&lt;<span class="number">5.0</span>,&gt;=<span class="number">4.11</span><span class="number">.2</span> (<span class="keyword">from</span> moviepy)</span><br><span class="line">  Downloading https:<span class="comment">//files.pythonhosted.org/packages/d1/f9/8cbd36ef8bf84c5281e4943eaa12fe34850a0e8204e44872d8ca0c0ec741/tqdm-4.29.0-py2.py3-none-any.whl (46kB)</span></span><br><span class="line">Requirement already satisfied: MarkupSafe&gt;=<span class="number">0.23</span> <span class="keyword">in</span> d:\python\lib\site-packages (<span class="keyword">from</span> Jinja2&gt;=<span class="number">2.4</span>-&gt;flask) (<span class="number">1.0</span>)</span><br><span class="line">Building wheels <span class="keyword">for</span> collected packages: imageio, moviepy</span><br><span class="line">  Running setup.py bdist_wheel <span class="keyword">for</span> imageio: started</span><br><span class="line">  Running setup.py bdist_wheel <span class="keyword">for</span> imageio: finished <span class="keyword">with</span> status <span class="string">'done'</span></span><br><span class="line">  Stored <span class="keyword">in</span> directory: C:\Users\suping3\AppData\Local\pip\Cache\wheels\e0\<span class="number">43</span>\<span class="number">31</span>\<span class="number">605</span>de9372ceaf657f152d3d5e82f42cf265d81db8bbe63cde1</span><br><span class="line">  Running setup.py bdist_wheel <span class="keyword">for</span> moviepy: started</span><br><span class="line">  Running setup.py bdist_wheel <span class="keyword">for</span> moviepy: finished <span class="keyword">with</span> status <span class="string">'done'</span></span><br><span class="line">  Stored <span class="keyword">in</span> directory: C:\Users\suping3\AppData\Local\pip\Cache\wheels\ad\<span class="number">92</span>\<span class="number">4</span>d\a6c6307d4c2219d002646bd4a5987e31fd5697f6ea7778b2c0</span><br><span class="line">Successfully built imageio moviepy</span><br><span class="line">Installing collected packages: pillow, imageio, ffmpeg-python, tqdm, moviepy</span><br><span class="line">Successfully installed ffmpeg-python<span class="number">-0.1</span><span class="number">.17</span> imageio<span class="number">-2.4</span><span class="number">.1</span> moviepy<span class="number">-0.2</span><span class="number">.3</span><span class="number">.5</span> pillow<span class="number">-5.4</span><span class="number">.1</span> tqdm<span class="number">-4.29</span><span class="number">.0</span></span><br><span class="line"></span><br><span class="line">suping3@BJ-D<span class="number">-212361</span>A MINGW64 /d/code/Meme-generator (master)</span><br><span class="line">$ cd ..</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">$ git clone https:<span class="comment">//github.com/East196/sorrypy</span></span><br><span class="line">Cloning into <span class="string">'sorrypy'</span>...</span><br><span class="line">remote: Enumerating objects: <span class="number">136</span>, done.</span><br><span class="line">remote: Total <span class="number">136</span> (delta <span class="number">0</span>), reused <span class="number">0</span> (delta <span class="number">0</span>), pack-reused <span class="number">136</span></span><br><span class="line">Receiving objects: <span class="number">100</span>% (<span class="number">136</span>/<span class="number">136</span>), <span class="number">27.71</span> MiB | <span class="number">230.00</span> KiB/s, done.</span><br><span class="line">Resolving deltas: <span class="number">100</span>% (<span class="number">55</span>/<span class="number">55</span>), done.</span><br><span class="line">Checking out files: <span class="number">100</span>% (<span class="number">48</span>/<span class="number">48</span>), done.</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">$ cd sorrypy/</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">$ python app.py</span><br><span class="line"> * Restarting <span class="keyword">with</span> stat</span><br><span class="line"> * Debugger is active!</span><br><span class="line"> * Debugger PIN: <span class="number">139</span><span class="number">-127</span><span class="number">-258</span></span><br><span class="line"> * Running on http:<span class="comment">//127.0.0.1:8000/ (Press CTRL+C to quit)</span></span><br><span class="line"><span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span> - - [<span class="number">11</span>/Jan/<span class="number">2019</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">43</span>] <span class="string">"GET / HTTP/1.1"</span> <span class="number">302</span> -</span><br><span class="line">--------------------------------------------------------------------------------</span><br><span class="line">DEBUG <span class="keyword">in</span> app [app.py:<span class="number">18</span>]:</span><br><span class="line">sorry</span><br><span class="line">--------------------------------------------------------------------------------</span><br><span class="line"><span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span> - - [<span class="number">11</span>/Jan/<span class="number">2019</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">43</span>] <span class="string">"GET /tpl/sorry/ HTTP/1.1"</span> <span class="number">200</span> -</span><br><span class="line"><span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span> - - [<span class="number">11</span>/Jan/<span class="number">2019</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">43</span>] <span class="string">"GET /static/w3.css HTTP/1.1"</span> <span class="number">200</span> -</span><br><span class="line"><span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span> - - [<span class="number">11</span>/Jan/<span class="number">2019</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">43</span>] <span class="string">"GET /static/cookies.js HTTP/1.1"</span> <span class="number">200</span> -</span><br><span class="line"><span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span> - - [<span class="number">11</span>/Jan/<span class="number">2019</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">43</span>] <span class="string">"GET /static/main.js HTTP/1.1"</span> <span class="number">200</span> -</span><br><span class="line"><span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span> - - [<span class="number">11</span>/Jan/<span class="number">2019</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">43</span>] <span class="string">"GET /static/sorry/template.mp4 HTTP/1.1"</span> <span class="number">200</span> -</span><br><span class="line"><span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span> - - [<span class="number">11</span>/Jan/<span class="number">2019</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">43</span>] <span class="string">"GET /favicon.ico HTTP/1.1"</span> <span class="number">404</span> -</span><br></pre></td></tr></table></figure>
<h3 id="采集数据"><a href="#采集数据" class="headerlink" title="采集数据"></a>采集数据</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line">composer <span class="built_in">require</span> jaeger/querylist</span><br><span class="line">use QL\QueryList;</span><br><span class="line"></span><br><span class="line"><span class="comment">//采集某页面所有的图片</span></span><br><span class="line">$data = QueryList::get(<span class="string">'http://cms.querylist.cc/bizhi/453.html'</span>)-&gt;find(<span class="string">'img'</span>)-&gt;attrs(<span class="string">'src'</span>);</span><br><span class="line"><span class="comment">//打印结果</span></span><br><span class="line">print_r($data-&gt;all());</span><br><span class="line">array:<span class="number">38</span> [▼</span><br><span class="line">  <span class="number">0</span> =&gt; <span class="string">"/dedemao/images/logo.png"</span></span><br><span class="line">  <span class="number">1</span> =&gt; <span class="string">"/dedemao/ad/top.png"</span></span><br><span class="line">  <span class="number">2</span> =&gt; <span class="string">"/dedemao/ad/article_ad1.jpg"</span></span><br><span class="line">  <span class="number">3</span> =&gt; <span class="string">"http://img.ithome.com/newsuploadfiles/2013/8/20130828_083615_449.jpg"</span></span><br><span class="line"><span class="comment">//采集某页面所有的超链接和超链接文本内容</span></span><br><span class="line"><span class="comment">//可以先手动获取要采集的页面源码</span></span><br><span class="line">$html = file_get_contents(<span class="string">'http://cms.querylist.cc/google/list_1.html'</span>);</span><br><span class="line"><span class="comment">//然后可以把页面源码或者HTML片段传给QueryList</span></span><br><span class="line">$data = QueryList::html($html)-&gt;rules([  <span class="comment">//设置采集规则</span></span><br><span class="line">    <span class="comment">// 采集所有a标签的href属性</span></span><br><span class="line">    <span class="string">'link'</span> =&gt; [<span class="string">'a'</span>,<span class="string">'href'</span>],</span><br><span class="line">    <span class="comment">// 采集所有a标签的文本内容</span></span><br><span class="line">    <span class="string">'text'</span> =&gt; [<span class="string">'a'</span>,<span class="string">'text'</span>]</span><br><span class="line">])-&gt;query()-&gt;getData();</span><br><span class="line"><span class="comment">//打印结果</span></span><br><span class="line">print_r($data-&gt;all());</span><br><span class="line">array:<span class="number">186</span> [▼</span><br><span class="line">  <span class="number">0</span> =&gt; array:<span class="number">2</span> [▼</span><br><span class="line">    <span class="string">"link"</span> =&gt; <span class="string">"/"</span></span><br><span class="line">    <span class="string">"text"</span> =&gt; <span class="string">""</span></span><br><span class="line">  ]</span><br><span class="line">  <span class="number">1</span> =&gt; array:<span class="number">2</span> [▼</span><br><span class="line">    <span class="string">"link"</span> =&gt; <span class="string">"/"</span></span><br><span class="line">    <span class="string">"text"</span> =&gt; <span class="string">"首页"</span></span><br><span class="line">  ]</span><br></pre></td></tr></table></figure>
<p>###<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">docker pull hihozhou/opencv</span><br><span class="line">git clone https:<span class="comment">//github.com/hihozhou/php-opencv.git</span></span><br><span class="line">cd php-opencv</span><br><span class="line">phpize</span><br><span class="line">./configure --<span class="keyword">with</span>-php-config=your php-config path</span><br><span class="line">make</span><br><span class="line">make install</span><br><span class="line"></span><br><span class="line">use <span class="function"><span class="keyword">function</span> <span class="title">CV</span>\</span>&#123; imread, imshow, waitkey, namedWindow&#125;;</span><br><span class="line"></span><br><span class="line">$im = imread(<span class="string">'Obama.png'</span>);<span class="comment">//load image</span></span><br><span class="line">namedWindow(<span class="string">'This is Obama id card'</span>,WINDOW_FULLSCREEN);<span class="comment">//create window</span></span><br><span class="line">imshow(<span class="string">'This is Obama id card'</span>,$im);<span class="comment">//show image on window</span></span><br><span class="line"></span><br><span class="line">waitkey(<span class="number">0</span>);</span><br><span class="line">$gray = imread(<span class="string">'Obama.png'</span>,IMREAD_GRAYSCALE);</span><br><span class="line"><span class="comment">//or</span></span><br><span class="line">use  <span class="function"><span class="keyword">function</span> <span class="title">CV</span>\</span>&#123; cvtColor&#125;;</span><br><span class="line">$gray = cvtColor($im, COLOR_BGR2GRAY);</span><br></pre></td></tr></table></figure></p>
<h3 id="中国城市关联"><a href="#中国城市关联" class="headerlink" title="中国城市关联"></a>中国城市关联</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br></pre></td><td class="code"><pre><span class="line">$ composer <span class="built_in">require</span> eachdemo/city-linkage:dev-master</span><br><span class="line"># 发布资源文件</span><br><span class="line">$ php artisan vendor:publish --provider=<span class="string">"Eachdemo\CityLinkage\CityServiceProvider"</span></span><br><span class="line"># 生成数据库 表</span><br><span class="line">$ php artisan migrate</span><br><span class="line">Schema::create(<span class="string">'city_linkage'</span>, <span class="function"><span class="keyword">function</span> (<span class="params">Blueprint $table</span>) </span>&#123;</span><br><span class="line">            $table-&gt;increments(<span class="string">'id'</span>);</span><br><span class="line">            $table-&gt;string(<span class="string">'name'</span>);</span><br><span class="line">            $table-&gt;smallInteger(<span class="string">'parent_id'</span>);</span><br><span class="line">            $table-&gt;string(<span class="string">'pinyin'</span>);</span><br><span class="line">            $table-&gt;string(<span class="string">'initial'</span>);</span><br><span class="line">            $table-&gt;string(<span class="string">'initials'</span>);</span><br><span class="line">            $table-&gt;string(<span class="string">'suffix'</span>);</span><br><span class="line">            $table-&gt;string(<span class="string">'code'</span>);</span><br><span class="line">            $table-&gt;string(<span class="string">'order'</span>);</span><br><span class="line">        &#125;);</span><br><span class="line"># 填充表数据</span><br><span class="line">$ php artisan db:seed --<span class="class"><span class="keyword">class</span></span>=CitySeeder</span><br><span class="line">In Container.php line <span class="number">752</span>:</span><br><span class="line"></span><br><span class="line">  Class CitySeeder does not exist</span><br><span class="line">$ composer dump-autoload</span><br><span class="line">Generating optimized autoload files</span><br><span class="line">&gt; Illuminate\Foundation\ComposerScripts::postAutoloadDump</span><br><span class="line">&gt; @php artisan package:discover</span><br><span class="line">Discovered Package: appstract/laravel-opcache</span><br><span class="line">Discovered Package: appstract/lush-http</span><br><span class="line">Discovered Package: barryvdh/laravel-dompdf</span><br><span class="line">Discovered Package: barryvdh/laravel-snappy</span><br><span class="line">Discovered Package: chumper/zipper</span><br><span class="line">Discovered Package: darkaonline/l5-swagger</span><br><span class="line">Discovered Package: eachdemo/city-linkage</span><br><span class="line">Discovered Package: encore/laravel-admin</span><br><span class="line">Discovered Package: fideloper/proxy</span><br><span class="line">Discovered Package: ibrand/laravel-database-logger</span><br><span class="line">Discovered Package: ibrand/laravel-miniprogram-poster</span><br><span class="line">Discovered Package: intervention/image</span><br><span class="line">Discovered Package: jellybool/flysystem-upyun</span><br><span class="line">Discovered Package: laravel/passport</span><br><span class="line">Discovered Package: laravel/socialite</span><br><span class="line">Discovered Package: laravel/tinker</span><br><span class="line">Discovered Package: maatwebsite/excel</span><br><span class="line">Discovered Package: mews/captcha</span><br><span class="line">Discovered Package: nesbot/carbon</span><br><span class="line">Discovered Package: niklasravnsborg/laravel-pdf</span><br><span class="line">Discovered Package: socialiteproviders/manager</span><br><span class="line">Discovered Package: tumobi/qqmap-region</span><br><span class="line">Discovered Package: tymon/jwt-auth</span><br><span class="line">Discovered Package: vetor/laravel-collect</span><br><span class="line">Discovered Package: wenslim/editormd</span><br><span class="line">Discovered Package: zgldh/qiniu-laravel-storage</span><br><span class="line">Package manifest generated successfully.</span><br><span class="line">php artisan db:seed --<span class="class"><span class="keyword">class</span></span>=CitySeeder 失败时可以执行先 composer dump-autoload 再执行 php artisan db:seed --<span class="class"><span class="keyword">class</span></span>=CitySeeder 填充</span><br><span class="line">&lt;?php</span><br><span class="line">namespace App\Http\Controllers;</span><br><span class="line"></span><br><span class="line">use Illuminate\Http\Request;</span><br><span class="line">use Eachdemo\CityLinkage\CityLinkage;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">DataController</span> <span class="keyword">extends</span> <span class="title">Controller</span></span></span><br><span class="line"><span class="class"></span>&#123;	</span><br><span class="line">    public <span class="function"><span class="keyword">function</span> <span class="title">test</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">    	$city = CityLinkage::getData();   		# 获取所有省份城市</span><br><span class="line">    	$city = CityLinkage::getData(1); 		# 获取北京市下所有区（北京id为1）</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="二维码"><a href="#二维码" class="headerlink" title="二维码"></a>二维码</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">composer <span class="built_in">require</span> endroid/qr-code</span><br><span class="line"><span class="comment">//composer require simplesoftwareio/simple-qrcode</span></span><br><span class="line"></span><br><span class="line">use Endroid\QrCode\QrCode;</span><br><span class="line"></span><br><span class="line">$qrCode = <span class="keyword">new</span> QrCode(<span class="string">'Life is too short to be generating QR codes'</span>);</span><br><span class="line"></span><br><span class="line">header(<span class="string">'Content-Type: '</span>.$qrCode-&gt;getContentType());</span><br><span class="line">echo $qrCode-&gt;writeString();</span><br><span class="line">composer <span class="built_in">require</span> khanamiryan/qrcode-detector-decoder</span><br><span class="line">use Zxing\QrReader;</span><br><span class="line"></span><br><span class="line">$qrcode = <span class="keyword">new</span> QrReader(<span class="string">'path/to_image'</span>);</span><br><span class="line">$text = $qrcode-&gt;text(); <span class="comment">//return decoded text from QR Code</span></span><br></pre></td></tr></table></figure>
<h3 id="生成-API-文档"><a href="#生成-API-文档" class="headerlink" title="生成 API 文档"></a>生成 API 文档</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line">composer <span class="built_in">require</span> wxm/ddoc --dev</span><br><span class="line">php artisan vendor:publish --provider=<span class="string">"Wxm\DDoc\DDocServiceProvider"</span> --force</span><br><span class="line">php artisan serve</span><br><span class="line">http:<span class="comment">//localhost:8000/ddoc</span></span><br><span class="line"></span><br><span class="line">vi routes/web.php</span><br><span class="line">namespace App\Http\Controllers;</span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * @Resource("登录令牌", uri="/token")</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">AuthController</span> <span class="keyword">extends</span> <span class="title">Controller</span></span></span><br><span class="line"><span class="class"></span>&#123;</span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 获取令牌</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * &gt; 通过手机号和密码获取会话`token`即登录凭证.</span></span><br><span class="line"><span class="comment">     * &gt; 需要认证的请求请携带此 Authorization 头</span></span><br><span class="line"><span class="comment">     * &gt;</span></span><br><span class="line"><span class="comment">     * &gt; Authorization：Bearer &#123;token&#125;</span></span><br><span class="line"><span class="comment">     * &gt; </span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * @Post("/")</span></span><br><span class="line"><span class="comment">     * @Versions(&#123;"v1"&#125;)</span></span><br><span class="line"><span class="comment">     * @Response(200, body=&#123;"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkueHkudGVzdFwvc2Vzc2lvbiIsImlhdCI6MTU0NTIxNjM5OSwiZXhwIjoxNTQ1MjE5OTk5LCJuYmYiOjE1NDUyMTYzOTksImp0aSI6Im9pZjV4WTNqS2JkbEhzVmQiLCJzdWIiOjEsInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.p3oAVkAxSCxTug5s6168N-ccfuCCywGDFiJ0b9zCXq8","token_type":"bearer","expires_in":3600&#125;)</span></span><br><span class="line"><span class="comment">     * @Parameters(&#123;</span></span><br><span class="line"><span class="comment">     *      @Parameter("phone", type="integer", required=true, description="手机号."),</span></span><br><span class="line"><span class="comment">     *      @Parameter("password", type="string", required=true, description="密码."),</span></span><br><span class="line"><span class="comment">     * &#125;)</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    public <span class="function"><span class="keyword">function</span> <span class="title">login</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br></pre></td></tr></table></figure>
<h3 id="生成identicon头像"><a href="#生成identicon头像" class="headerlink" title="生成identicon头像"></a>生成identicon头像</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">composer <span class="built_in">require</span> valiner/identicon-avatar</span><br><span class="line"><span class="built_in">require</span> __DIR__.<span class="string">'/vendor/autoload.php'</span>;</span><br><span class="line"></span><br><span class="line">use Valiner\IdenticonAvatar\Identicon;</span><br><span class="line"></span><br><span class="line">$identicon = <span class="keyword">new</span> Identicon();</span><br><span class="line"><span class="comment">//浏览器输出'sdp'的125px的图像https://github.com/valiner/identicon-avatar</span></span><br><span class="line">$identicon-&gt;getAvatar(<span class="string">'sdp'</span>,<span class="number">125</span>);</span><br></pre></td></tr></table></figure>
<h3 id="像-cms-一样安装-Laravel-项目"><a href="#像-cms-一样安装-Laravel-项目" class="headerlink" title="像 cms 一样安装 Laravel 项目"></a>像 cms 一样安装 Laravel 项目</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">composer <span class="built_in">require</span> rachidlaasri/laravel-installer</span><br><span class="line">php artisan vendor:publish --tag=laravelinstaller</span><br><span class="line">php artisan serve</span><br><span class="line">localhost:<span class="number">8000</span>/install  update</span><br></pre></td></tr></table></figure>
<h3 id="全新-PHP-运行时环境"><a href="#全新-PHP-运行时环境" class="headerlink" title="全新 PHP 运行时环境"></a>全新 PHP 运行时环境</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">git clone https:<span class="comment">//github.com/polarphp/polarphp.git</span></span><br><span class="line">cd polarphp</span><br><span class="line">git submodule init</span><br><span class="line">git submodule update</span><br><span class="line">git checkout v0<span class="number">.0</span><span class="number">.1</span>-alpha</span><br><span class="line">./devtools/scripts/build_polarphp.sh</span><br><span class="line"></span><br><span class="line">docker run --rm -it polarphp_debug</span><br><span class="line">polar --version</span><br></pre></td></tr></table></figure>
<h3 id="url-生成二维码"><a href="#url-生成二维码" class="headerlink" title="url 生成二维码"></a>url 生成二维码</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">composer <span class="built_in">require</span> <span class="string">"simplesoftwareio/simple-qrcode: ~2"</span></span><br><span class="line">QrCode::generate(<span class="string">'Make me into a QrCode!'</span>);</span><br><span class="line">QrCode::generate(<span class="string">'Make me into a QrCode!'</span>, <span class="string">'../public/qrcodes/qrcode.svg'</span>);</span><br><span class="line">QrCode::encoding(<span class="string">'UTF-8'</span>)-&gt;generate(<span class="string">'Make me a QrCode with special symbols ♠♥!!'</span>);</span><br><span class="line">QrCode::merge($filename, $percentage, $absolute);</span><br><span class="line"></span><br><span class="line"><span class="comment">//Generates a QrCode with an image centered in the middle.</span></span><br><span class="line">QrCode::format(<span class="string">'png'</span>)-&gt;merge(<span class="string">'path-to-image.png'</span>)-&gt;generate();</span><br><span class="line">QrCode::BTC($address, $amount);</span><br><span class="line"></span><br><span class="line"><span class="comment">//Sends a 0.334BTC payment to the address</span></span><br><span class="line">QrCode::BTC(<span class="string">'bitcoin address'</span>, <span class="number">0.334</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">//Sends a 0.334BTC payment to the address with some optional arguments</span></span><br><span class="line">QrCode::size(<span class="number">500</span>)-&gt;BTC(<span class="string">'address'</span>, <span class="number">0.0034</span>, [</span><br><span class="line">    <span class="string">'label'</span> =&gt; <span class="string">'my label'</span>,</span><br><span class="line">    <span class="string">'message'</span> =&gt; <span class="string">'my message'</span>,</span><br><span class="line">    <span class="string">'returnAddress'</span> =&gt; <span class="string">'https://www.returnaddress.com'</span></span><br><span class="line">]);</span><br><span class="line">QrCode::email(<span class="string">'foo@bar.com'</span>);</span><br><span class="line">https:<span class="comment">//learnku.com/articles/19436#topnav</span></span><br></pre></td></tr></table></figure>
<h3 id="gif图片转字符"><a href="#gif图片转字符" class="headerlink" title="gif图片转字符"></a>gif图片转字符</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">https:<span class="comment">//github.com/hit9/gif2txt</span></span><br><span class="line">python gif2txt.py test.gif -m <span class="number">80</span> -o examples/out.html</span><br><span class="line">python gif2txt.py test.gif -m <span class="number">80</span> -o examples/withcolor.html -c</span><br><span class="line">python gif2txt.py pacman.gif -o examples/pacman.html -c --green-screen-sensibility <span class="number">128</span></span><br><span class="line">python gif2txt.py test.gif -r -o examples/reversegreenscreen.html</span><br><span class="line"></span><br><span class="line">在线浏览动图https:<span class="comment">//hit9.github.io/gif2txt/examples/out.html</span></span><br></pre></td></tr></table></figure>
<h3 id="PHP-提取文章关键词"><a href="#PHP-提取文章关键词" class="headerlink" title="PHP 提取文章关键词"></a>PHP 提取文章关键词</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">composer <span class="built_in">require</span> fukuball/jieba-php:dev-master</span><br><span class="line">&lt;?php <span class="comment">// index.php</span></span><br><span class="line">include_once <span class="string">'./vendor/autoload.php'</span>;</span><br><span class="line"></span><br><span class="line">ini_set(<span class="string">'memory_limit'</span>, <span class="string">'600M'</span>);</span><br><span class="line"></span><br><span class="line">use Fukuball\Jieba\Jieba;</span><br><span class="line">use Fukuball\Jieba\Finalseg;</span><br><span class="line">use Fukuball\Jieba\JiebaAnalyse;</span><br><span class="line"></span><br><span class="line">Jieba::init(array(<span class="string">'mode'</span> =&gt; <span class="string">'test'</span>, <span class="string">'dict'</span> =&gt; <span class="string">'small'</span>));</span><br><span class="line">Finalseg::init();</span><br><span class="line">JiebaAnalyse::init();</span><br><span class="line"></span><br><span class="line">$top_k = <span class="number">10</span>; <span class="comment">// 获取前10个关键词</span></span><br><span class="line">$content = file_get_contents(<span class="string">'./test.txt'</span>);</span><br><span class="line"></span><br><span class="line">$tags = JiebaAnalyse::extractTags($content, $top_k);</span><br><span class="line"></span><br><span class="line">var_dump($tags);</span><br><span class="line">https:<span class="comment">//blog.foof.dev/posts/php-0</span></span><br></pre></td></tr></table></figure>
<p><a href="https://github.com/jc91715/oc-plugin-music plugins/jc91715/music" target="_blank" rel="noopener">音乐聚合搜索</a></p>
<p><a href="https://github.com/alhimik1986/php-excel-templator" target="_blank" rel="noopener">php excel样式</a></p>
<p><a href="https://github.com/rap2hpoutre/fast-excel" target="_blank" rel="noopener">快速Excel</a></p>
<p><a href="https://github.com/crazyhl/php_jump_auto" target="_blank" rel="noopener">微信跳一跳的 php 版本https://www.h57.pw/2018/01/05/use-php-to-achieve-wechat-jump-for-android-phones/</a></p>
<p><a href="https://learnku.com/articles/28049" target="_blank" rel="noopener">PHP 高效的开发量化数字货币交易程序 github.com/zhouaini528/exchanges-php</a></p>
<p><a href="https://learnku.com/articles/24941" target="_blank" rel="noopener">PHP实现PCM格式音波文件转WAV格式音频文件</a></p>
<p><a href="https://www.fanhaobai.com/2017/05/composer.html" target="_blank" rel="noopener">搭建私有仓库</a></p>
<p><a href="https://github.com/zorlan/skycaiji" target="_blank" rel="noopener">PHP 爬虫系统 </a></p>
<p><a href="https://github.com/shockerli/php-awesome" target="_blank" rel="noopener">PHP 最优秀资源的整理汇集 </a></p>
<p><a href="https://github.com/adsr/phpspy" target="_blank" rel="noopener">PHP火焰图工具，支持php7</a></p>
<p><a href="https://www.oschina.net/news/103996/introduce-polarphp?from=groupmessage" target="_blank" rel="noopener">将PHP语言打造成为一门真正的通用性脚本语言</a></p>
<p><a href="https://github.com/mishe/blog/issues/129" target="_blank" rel="noopener">API 接口设计规范</a></p>
<p><a href="https://github.com/jianyan74/php-excel" target="_blank" rel="noopener">PhpSpreadsheet 简单 Excel 导入导出</a></p>
<p><a href="https://learnku.com/laravel/t/17232" target="_blank" rel="noopener">阅读过的干货文章</a></p>
<p><a href="https://github.com/FriendsOfPHP/Sami" target="_blank" rel="noopener">生成 API https://laravel.com/api/5.7/index.html</a></p>
<p><a href="http://phpbench.com/" target="_blank" rel="noopener">有 if 一定要有 else</a></p>
<p><a href="http://www.syyong.com/other/Dokuwiki-Secondary-Development-Record.html" target="_blank" rel="noopener">Dokuwiki 二次开发记录</a></p>
<p><a href="https://learnku.com/articles/19427" target="_blank" rel="noopener">Laravel5.5 支付宝支付</a></p>
<p><a href="https://laravel-china.org/articles/22338#478a16" target="_blank" rel="noopener">php函数</a></p>
<p><a href="https://laravel-china.org/articles/22323?#reply78161" target="_blank" rel="noopener">Windows 下最详细的源码编译 PHP 以及 PHP 扩展</a></p>
<p><a href="http://querylist.cc/querylist-test/" target="_blank" rel="noopener">在线采集数据</a></p>
<p><a href="https://github.com/uuk020/logistics?utm_source=gold_browser_extension" target="_blank" rel="noopener">PHP 多接口获取快递物流信息包</a></p>
<p><a href="https://github.com/nextcloud/server?utm_source=gold_browser_extension" target="_blank" rel="noopener">私有云服务器</a></p>
<p><a href="https://github.com/chenlinzhong/php-delayqueue" target="_blank" rel="noopener">基于redis实现高可用，易拓展，接入方便，生产环境稳定运行的延迟队列</a></p>
<p><a href="https://laravel-china.org/articles/17883" target="_blank" rel="noopener">JWT 超详细分析</a></p>
<p><a href="https://laravelacademy.org/post/3640.html" target="_blank" rel="noopener">Laravel 5 中使用 JWT</a></p>
<p><a href="https://segmentfault.com/p/1210000011003394/read#top" target="_blank" rel="noopener">别再这样使用JWT了！</a></p>
<p><a href="http://www.beanbun.org/#/?id=%E5%AE%89%E8%A3%85" target="_blank" rel="noopener"> PHP 编写的多进程网络爬虫框架</a></p>
<p><a href="https://segmentfault.com/a/1190000014782815" target="_blank" rel="noopener">laravel扩展包——laravel-dompdf和laravel-snappy</a></p>
<p><a href="https://blog.cooooler.com/2018/08/29/%E6%80%BB%E7%BB%93%E4%B8%80%E4%B8%8Blaravel%E4%B8%AD%E8%BF%9B%E8%A1%8CPDF%E5%AF%BC%E5%87%BA%E9%81%87%E5%88%B0%E7%9A%84%E9%97%AE%E9%A2%98/" target="_blank" rel="noopener">laravel中进行PDF导出遇到的问题</a></p>
<p><a href="http://www.cnblogs.com/xxoome/p/6083542.html" target="_blank" rel="noopener">解决larave-dompdf中文字体显示问题</a></p>
<p><a href="https://laravel-china.org/topics/2477/dompdf-on-the-export-of-chinese-garbled-question/" target="_blank" rel="noopener">关于 DomPDF 导出中文乱码问题</a></p>
<p><a href="https://laravel-china.org/articles/20815" target="_blank" rel="noopener">Web 安全之 XSS Platform 搭建及使用实践</a></p>
<p><a href="https://segmentfault.com/a/1190000018471055" target="_blank" rel="noopener">PHP比特币开发系列教程汇总</a></p>
<p><a href="https://github.com/alicfeng/IdentityCard" target="_blank" rel="noopener">中国（大陆）公民身份证类</a></p>
<p><a href="https://github.com/Gopusher/gateway" target="_blank" rel="noopener">消息推送系统</a></p>
<p><a href="https://github.com/xiaohuilam/laravel/wiki" target="_blank" rel="noopener">Laravel 深入浅出指南 </a></p>
<p><a href="https://laravel-china.org/articles/17553" target="_blank" rel="noopener"> implode.io 记录分享你的代码片段</a></p>
<p><a href="https://github.com/overtrue/yike.io" target="_blank" rel="noopener">小程序社区</a></p>
<p><a href="https://laravel-china.org/articles/22028" target="_blank" rel="noopener">php以太坊</a></p>
<p><a href="https://github.com/Gopusher/laravel-chat" target="_blank" rel="noopener">聊天应用</a></p>
<p><a href="https://github.com/jormin/laravel-ddoc" target="_blank" rel="noopener">数据字典自动生成文档</a></p>
<p><a href="https://coffeephp.com/articles/4#20%E8%AE%BE%E8%AE%A1%E4%B8%80%E4%B8%AA%E7%A7%92%E6%9D%80%E7%B3%BB%E7%BB%9F" target="_blank" rel="noopener">PHPer的面试总结</a></p>
<p><a href="https://implode.io/" target="_blank" rel="noopener">方便 PHPer，Laraveler 测试代码的有用工具</a></p>
<p><a href="https://github.com/appzcoder/30-seconds-of-php-code" target="_blank" rel="noopener">30s php</a></p>
<p><a href="https://juejin.im/post/5b67b50a6fb9a04fda4e3902" target="_blank" rel="noopener">巧用 PHP 数组函数</a></p>
<p><a href="https://laravel-china.org/articles/20277" target="_blank" rel="noopener"> Snowflake 生成分布式唯一 ID</a></p>
<p><a href="https://laravel-china.org/topics/21368" target="_blank" rel="noopener">ZipArchive 解压中文文件乱码</a></p>
<p><a href="https://laravel-china.org/articles/17867?#reply76200" target="_blank" rel="noopener">简聊 Session 与 Token 身份验证</a></p>
<p><a href="https://github.com/xkeyi/aliyun-sms" target="_blank" rel="noopener">基于阿里云短信服务的 PHP 扩展包</a></p>
<p><a href="https://laravel-china.org/topics/19786" target="_blank" rel="noopener">中国标准行政区划数据</a></p>
<p><a href="https://laravel-china.org/articles/19867?#reply76298" target="_blank" rel="noopener">实用 Markdown 编辑器</a></p>
<p><a href="https://laravel-china.org/articles/20247" target="_blank" rel="noopener">你可能不太需要 Laravel-Excel</a></p>
<p><a href="https://laravel-china.org/articles/20450" target="_blank" rel="noopener">Laravel HTML 导出 PDF 方案 —– wkhtmltopdf Laravel-snappy</a></p>
<p><a href="https://github.com/arnaud-lb/php-rdkafka" target="_blank" rel="noopener">php-rdkafka</a></p>
<p><a href="https://github.com/DarkaOnLine/L5-Swagger" target="_blank" rel="noopener">laravel Swagger</a></p>
<p><a href="https://github.com/PrintNow/php-sorry-gif" target="_blank" rel="noopener">在线制作 sorry 为所欲为</a></p>
<p><a href="https://laravel-china.org/articles/21870?#reply77085" target="_blank" rel="noopener">nginx 实现动态生成缩略图</a></p>
<p><a href="http://www.dahouduan.com/2017/09/18/php-consume-kafka/" target="_blank" rel="noopener">PHP 处理kafka消息实例</a></p>
<p><a href="https://github.com/dedemao/alipay" target="_blank" rel="noopener">一个PHP文件搞定支付宝支付系列</a></p>
<p><a href="https://segmentfault.com/a/1190000015765348#articleHeader0" target="_blank" rel="noopener">PHP下kafka的实践</a></p>
<p><a href="https://aiddroid.com/kafka-introduction-and-php-kafka-usage/" target="_blank" rel="noopener">使用PHP处理Kafka消息</a></p>
<p><a href="https://github.com/weiboad/kafka-php/blob/master/README_CH.md" target="_blank" rel="noopener">Kafka-php</a></p>
<p><a href="https://github.com/KEN-studio/laravel-wechat-robot-personal" target="_blank" rel="noopener">基于 Laravel 可灵活自定义的的私人微信机器人</a></p>
<p><a href="https://laravel-china.org/articles/4389/simple-and-easy-to-deploy-your-project-deployer" target="_blank" rel="noopener">简单轻松部署你的项目 - Deployer</a></p>
<p><a href="https://laravel-china.org/articles/22410" target="_blank" rel="noopener">PHP 资源列表大全</a></p>
<p><a href="https://www.kancloud.cn/webxyl/php_oop/68885" target="_blank" rel="noopener">php面向对象</a></p>
<p><a href="https://github.com/qbhy/baidu-aip-sdk" target="_blank" rel="noopener">百度AI开放平台 PHP SDK</a></p>
<p><a href="https://github.com/xkeyi/aliyun-sms" target="_blank" rel="noopener">阿里云短信服务的 PHP 扩展包</a></p>
<p><a href="https://segmentfault.com/a/1190000014239648" target="_blank" rel="noopener">PHP使用QueryList采集微信文章页</a></p>
<p><a href="https://doc.phpopencv.org/" target="_blank" rel="noopener">PHP人工智能</a></p>
<p><a href="https://github.com/duckchat/gaga" target="_blank" rel="noopener">PHP 编写的聊天软件</a></p>
<p><a href="https://github.com/yan68/xcrawler" target="_blank" rel="noopener">PHP爬虫框架</a></p>
<p><a href="https://mp.weixin.qq.com/s/39qWjkTwy_A2vd7ZY8gRTQ" target="_blank" rel="noopener">支付系统</a></p>
<p><a href="https://github.com/iymiym/leetcode" target="_blank" rel="noopener">php leetcode </a></p>
<p><a href="http://phpfiddle.org/#" target="_blank" rel="noopener">在线测试PHP</a></p>
<p><a href="https://learnku.com/articles/17883" target="_blank" rel="noopener">JWT 超详细分析</a></p>
<p><a href="https://learnku.com/articles/24172" target="_blank" rel="noopener">PHP 面试常考内容之面向对象</a></p>
<p><a href="http://blog.text.wiki/2016/06/15/problem-tips.html" target="_blank" rel="noopener">PHP性能监控问题记录之一－安装配置php-apm</a></p>
<p><a href="http://www.54php.cn/default/223.html" target="_blank" rel="noopener">PHP实现 手机号码归属地查询</a></p>
<p><a href="https://kuricat.com/articles/nginx-to-php-fpm-fcfvq" target="_blank" rel="noopener">Nginx to PHP-FPM</a></p>
<p><a href="https://github.com/apanly/open_kf_v1" target="_blank" rel="noopener">编程浪子开源云客服</a></p>
<p><a href="https://github.com/metowolf/Meting" target="_blank" rel="noopener">音乐api</a></p>
<p><a href="https://www.paycats.cn/" target="_blank" rel="noopener">帮助个人开发者在线收款的接口服务</a></p>
<p><a href="https://github.com/hunzhiwange/queryphp" target="_blank" rel="noopener">爬虫框架</a></p>
<p><a href="https://gitee.com/zeng2/musicPhp" target="_blank" rel="noopener">PHP下载音乐</a></p>
<p><a href="https://github.com/aiqq363927173/chat-im" target="_blank" rel="noopener">web即时聊天</a></p>
<p><a href="https://github.com/igbinary/igbinary" target="_blank" rel="noopener">替代serialize的扩展igbinary</a></p>
<p><a href="https://github.com/guanguans/dnmp-plus" target="_blank" rel="noopener">Docker+Nginx+MySQL+PHP (xhprof、tideways)+xhgui开发环境</a></p>
<p><a href="https://learnku.com/articles/29686" target="_blank" rel="noopener">PHP 并发场景</a></p>
<p><a href="https://github.com/maicong/music" target="_blank" rel="noopener">多站合一音乐搜索解决方案</a></p>
<p><a href="https://www.ctolib.com/categories/php-command-line.html" target="_blank" rel="noopener">构建命令行工具的库</a></p>
<p><a href="https://github.com/wizarot/redis-cli" target="_blank" rel="noopener">PHP版本的 Redis命令行客户端</a></p>
<p><a href="https://github.com/kaixin1995/InformationPush" target="_blank" rel="noopener">个人微信模板信息推送</a></p>
<p><a href="https://github.com/guyueyingmu/avbook" target="_blank" rel="noopener">av电影管理系统https://github.com/hldh214/gas</a></p>
<p><a href="https://github.com/guanguans/soar-php" target="_blank" rel="noopener">SQL 语句优化器和重写器的 PHP 扩展包</a></p>
<p><a href="https://github.com/yiranzai/php-tools" target="_blank" rel="noopener">不一样的PHP工具类</a></p>
<p><a href="https://geixue.com/" target="_blank" rel="noopener">php视频网站</a></p>
<p><a href="https://learnku.com/articles/25865" target="_blank" rel="noopener">画江湖之算法篇</a></p>
<p><a href="https://github.com/zzjzz9266a/91porn_php" target="_blank" rel="noopener">91porn爬虫php版本</a></p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/php/" rel="tag"># php</a>
          
            <a href="/tags/项目/" rel="tag"># 项目</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/12/10/laravel-swoole/" rel="next" title="laravel swoole">
                <i class="fa fa-chevron-left"></i> laravel swoole
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/12/12/有用的Python项目收集/" rel="prev" title="有用的Python项目收集">
                有用的Python项目收集 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
          <div class="comments" id="comments">
             <div id="gitment-container"></div>
         </div>
  




        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">苏生不惑</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">382</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">37</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/sushengbuhuo" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mysusheng@gmail.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://plus.google.com/mysusheng" target="_blank" title="Google">
                      
                        <i class="fa fa-fw fa-google"></i>Google</a>
                  </span>
                
            </div>
          

          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                Links
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="http://v2ex.com/" title="v2ex" target="_blank">v2ex</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.fanhaobai.com/" title="fanhaobai" target="_blank">fanhaobai</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://yuanxuxu.com/archives/" title="yuanxuxu" target="_blank">yuanxuxu</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.snail-c.cn/article" title="snail-c" target="_blank">snail-c</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://showcj.com/archives" title="showcj" target="_blank">showcj</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://vultr.aicnm.com/%E6%9C%80%E6%96%B0Vultr%E6%B3%A8%E5%86%8C%E5%8F%8AVPS%E8%B4%AD%E4%B9%B0%E5%9B%BE%E6%96%87%E6%95%99%E7%A8%8B/" title="vultr" target="_blank">vultr</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.lucissfer.com/" title="lucissfer" target="_blank">lucissfer</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://blog.csdn.net/fdipzone/article/details/79352685" title="傲雪星枫" target="_blank">傲雪星枫</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.yoby123.cn/index.php/category/default/" title="小白的分享" target="_blank">小白的分享</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.cnblogs.com/52fhy/p/5819995.html" title="PHP攻城狮" target="_blank">PHP攻城狮</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://blog.jiaojie.site/" title="php" target="_blank">php</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://sphard.com/archives/" title="sphard" target="_blank">sphard</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://yuanxuxu.com/archives/" title="LNMP技术栈笔记" target="_blank">LNMP技术栈笔记</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.coding10.com/" title="学习 Laravel" target="_blank">学习 Laravel</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://shuwoom.com/?page_id=929" title="区块链学习指南" target="_blank">区块链学习指南</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://greenlightt.github.io/archives/" title="greenlightt" target="_blank">greenlightt</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.0php.net/archives/" title="0php" target="_blank">0php</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.fordba.com/category/mysql" title="mysql" target="_blank">mysql</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.itcodemonkey.com/" title="程序员" target="_blank">程序员</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.yanshuo.me/r/v2ex" title="言说" target="_blank">言说</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.timiguo.com/archive.html" title="提米果的博客" target="_blank">提米果的博客</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://phpartisan.cn/news/112.html" title="phpartisan" target="_blank">phpartisan</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.cnblogs.com/52fhy/" title="飞鸿影" target="_blank">飞鸿影</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.54php.cn/" title="54php" target="_blank">54php</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.lazyman.vip/" title="营销" target="_blank">营销</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.njphper.com/archives/" title="做人呢最重要的就是开心" target="_blank">做人呢最重要的就是开心</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.h57.pw/" title="php 初心者" target="_blank">php 初心者</a>
                  </li>
                
              </ul>
            </div>
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#excel"><span class="nav-number">1.</span> <span class="nav-text">excel</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#B-站直播实用脚本"><span class="nav-number">2.</span> <span class="nav-text">B 站直播实用脚本</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#XSS-Platform"><span class="nav-number">3.</span> <span class="nav-text">XSS Platform</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#生成小程序图文海报"><span class="nav-number">4.</span> <span class="nav-text">生成小程序图文海报</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#HTML-导出-PDF"><span class="nav-number">5.</span> <span class="nav-text">HTML 导出 PDF</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#zip"><span class="nav-number">6.</span> <span class="nav-text">zip</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Walle-瓦力上线部署系统正确安装"><span class="nav-number">7.</span> <span class="nav-text">Walle-瓦力上线部署系统正确安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#api文档swagger"><span class="nav-number">8.</span> <span class="nav-text">api文档swagger</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#手机上利用PHP完成对电脑的操作"><span class="nav-number">9.</span> <span class="nav-text">手机上利用PHP完成对电脑的操作</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#隐藏你的-ID"><span class="nav-number">10.</span> <span class="nav-text">隐藏你的 ID</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#书童机器人"><span class="nav-number">11.</span> <span class="nav-text">书童机器人</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#格式化sql"><span class="nav-number">12.</span> <span class="nav-text">格式化sql</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#jwt"><span class="nav-number">13.</span> <span class="nav-text">jwt</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#php版为所欲为"><span class="nav-number">14.</span> <span class="nav-text">php版为所欲为</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#采集数据"><span class="nav-number">15.</span> <span class="nav-text">采集数据</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#中国城市关联"><span class="nav-number">16.</span> <span class="nav-text">中国城市关联</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#二维码"><span class="nav-number">17.</span> <span class="nav-text">二维码</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#生成-API-文档"><span class="nav-number">18.</span> <span class="nav-text">生成 API 文档</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#生成identicon头像"><span class="nav-number">19.</span> <span class="nav-text">生成identicon头像</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#像-cms-一样安装-Laravel-项目"><span class="nav-number">20.</span> <span class="nav-text">像 cms 一样安装 Laravel 项目</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#全新-PHP-运行时环境"><span class="nav-number">21.</span> <span class="nav-text">全新 PHP 运行时环境</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#url-生成二维码"><span class="nav-number">22.</span> <span class="nav-text">url 生成二维码</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#gif图片转字符"><span class="nav-number">23.</span> <span class="nav-text">gif图片转字符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#PHP-提取文章关键词"><span class="nav-number">24.</span> <span class="nav-text">PHP 提取文章关键词</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

<div class="copyright">&copy; <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">苏生不惑</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>



<div>
<span id="showDays"></span>

</div>

<span id="busuanzi_container_site_pv">
   总访问量:<span id="busuanzi_value_site_pv"></span>次
</span>



  <span class="post-meta-divider">|</span>



<div class="theme-info">
  <div class="powered-by"></div>
  <span class="post-count">博客全站共773.8k字</span>
</div>
<script>
var birthDay = new Date("11/20/2018");
var now = new Date();
var duration = now.getTime() - birthDay.getTime();
var total= Math.floor(duration / (1000 * 60 * 60 * 24));
document.getElementById("showDays").innerHTML = "本站已运行 "+total+" 天";
</script>

        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      人次
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      次
    </span>
  
</div>








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  











<script type="text/javascript">
    (function() {
        // 匿名函数，防止污染全局变量
        var utterances = document.createElement('script');
        utterances.type = 'text/javascript';
        utterances.async = true;
        utterances.setAttribute('issue-term','0')
        utterances.setAttribute('theme','')
        utterances.setAttribute('repo','sushengbuhuo/laravel_ioc_demo')
        utterances.crossorigin = 'anonymous';
        utterances.src = 'https://utteranc.es/client.js';
        // content 是要插入评论的地方
        document.getElementById('gitment-container').appendChild(utterances);
    })();
</script>


  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  
  

  

  

  

  
<script>
  ((window.gitter = {}).chat = {}).options = {
    //room替换成自己的聊天室名称即可，room的名称规则是：username/roomname
    room: 'sushengbuhuo-chat/mychat'
  };
</script>
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>

</body>
</html>
